package Decorateur;

import Composite.Element;
import fichiers.*;
import java.awt.*;
import java.io.*;
import javax.swing.*;
//import javax.swing.filechooser.FileSystemView;
import javax.swing.tree.*;

public class MyDefaultTreeCellRendererPicasial extends DefaultTreeCellRenderer{
    

    private TreeCellRenderer next;   
    
    // EN COMMENTAIRE PARTIE POUR RECUPERER LES FICHIERS SELONS LE SYSTEME
    /*
    private static JFileChooser jf=new JFileChooser();
    */

    
    public MyDefaultTreeCellRendererPicasial(TreeCellRenderer next) {
    
        this.next=next;
    }
    
    public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus) {
        
        DefaultMutableTreeNode t=(DefaultMutableTreeNode)value;
        Element f=(Element)t.getUserObject();
        
        /*
        File fichier=f.getFichierCourant();*/
        // iconElement=(ImageIcon) jf.getFileSystemView().getSystemIcon(fichier);          
        JLabel valeurLabel=(JLabel) next.getTreeCellRendererComponent(tree,value,sel,expanded,leaf,row,hasFocus);
        valeurLabel.setIcon(f.getRepresentation());

                   
        return valeurLabel;
    }
    
    
}
